UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pU9nzRWaEXlt5mukMExLUltImZzdujrZCuxI4yhept4=' 
WHERE 
  key_id = '0ba049f28209dafc197c92e8926dc62d89b6513751c85cae155df7adfa9ae42d' 
  AND (
    token = 'pU9nzRWaEXlt5mukMExLUltImZzdujrZCuxI4yhept4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036