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

Query time 0.00017