UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lyzfmfCjDXr7cNbT7YsMJYtjqQ/TLfXJWbpLEsRKvew=' 
WHERE 
  key_id = '3a489d84bd9d94bf421acef5742f4469c568a49dcf4d62c481472cd754a1da2d' 
  AND (
    token = 'lyzfmfCjDXr7cNbT7YsMJYtjqQ/TLfXJWbpLEsRKvew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042