UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ffFHwvt50O/4OZRe0Z49m+ZRAyjxoUItq31U/OB/BbM=' 
WHERE 
  key_id = 'a5ec4b0a1e1cf65ddc27b2c8fb539b86e7cdc073010c42ce5636b9ee8f0ad147' 
  AND (
    token = 'ffFHwvt50O/4OZRe0Z49m+ZRAyjxoUItq31U/OB/BbM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037