UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mgqhYomKG6RrZdRsDIALLBAA4soI+P4sSMEMN3MZs58=' 
WHERE 
  key_id = '6f8d548267a9ce0bacb9c33d0556fde08d4c03e4dc6606cedcdad47898a0ba06' 
  AND (
    token = 'mgqhYomKG6RrZdRsDIALLBAA4soI+P4sSMEMN3MZs58=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017