UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qhzcDuhPPTB4aW1QoyCNv8vYBy3L05N/l65DA6VzweY=' 
WHERE 
  key_id = '0d495c0c327b4c77cfd7a09542fdc5bb8796938d025ad7d806049d32651f0e56' 
  AND (
    token = 'qhzcDuhPPTB4aW1QoyCNv8vYBy3L05N/l65DA6VzweY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017