UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G0tuOF2vCVB6ODdfnm6N6VZ1JsB+KMoQfWI25PhMnsc=' 
WHERE 
  key_id = '77c97e6c3d317ee552232737f297ccfa512dc673fb50a44d1b545b73b92aa17f' 
  AND (
    token = 'G0tuOF2vCVB6ODdfnm6N6VZ1JsB+KMoQfWI25PhMnsc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030