UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1faJb2I1AazZ+lYwKatKsMW8bz0KYturk+RSEfEOumU=' 
WHERE 
  key_id = '55690955c4407a36694e83759a10cd816b43183fa25b0fc724a373e0754ce808' 
  AND (
    token = '1faJb2I1AazZ+lYwKatKsMW8bz0KYturk+RSEfEOumU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027