UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sTjbeP3rCMmygDbVKBv00OithrdZTGg2gWdw0PY2Xsg=' 
WHERE 
  key_id = 'f87008fac925e4d7b0185f6cbc6b40f122cf55d58dd360175275649188345992' 
  AND (
    token = 'sTjbeP3rCMmygDbVKBv00OithrdZTGg2gWdw0PY2Xsg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034