UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yKdyXq1A8C1ShUNP/g02+8CALnggKuGQUhJObjwbj/0=' 
WHERE 
  key_id = 'e587d096557a83d0bf4fc3395b1fd8428779c5207989edf533f1439d55474565' 
  AND (
    token = 'yKdyXq1A8C1ShUNP/g02+8CALnggKuGQUhJObjwbj/0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029