UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GLncx7R0vvFdWiJrLiDVsjzYKIAYd9Df/wAHVzdDSb8=' 
WHERE 
  key_id = '5587fd0e2082380e920f429ceb9476eb27eb2f955f1d0ef00d10cea984272846' 
  AND (
    token = 'GLncx7R0vvFdWiJrLiDVsjzYKIAYd9Df/wAHVzdDSb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022