UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kgmlh4zz01HlDD63kcraFHFWRyVrXdooI9hRHkNCcRY=' 
WHERE 
  key_id = '3d213ea7bf4843de9c46a59d0a4692fe9f5f8eb139ace9178711aacd438b86b5' 
  AND (
    token = 'kgmlh4zz01HlDD63kcraFHFWRyVrXdooI9hRHkNCcRY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036