UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oyxFOyGhvwkK2GJxaD4UWvpS5txyyfHjbCsLAT6hhd4=' 
WHERE 
  key_id = '2b5832db35a225136c228ae4c378fe254b282642a3a86d8de4994c1864f30f08' 
  AND (
    token = 'oyxFOyGhvwkK2GJxaD4UWvpS5txyyfHjbCsLAT6hhd4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025