UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q4L42nW6acRqzIoW3TeyG1dNr2wcPhPGVb+ssqhsV0A=' 
WHERE 
  key_id = 'b29bef82625b027453944a2cd131bbde08af35ada5e0c687020d2618c1cd7705' 
  AND (
    token = 'Q4L42nW6acRqzIoW3TeyG1dNr2wcPhPGVb+ssqhsV0A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023