UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y+J70lzMpKhuxV3OVSyjPIoyyX+uSj3sfkWqdZ1jrZs=' 
WHERE 
  key_id = 'e3a1b4418e35e41fb5f1954802d244653c616382fa9f461fb3d59f9429259df4' 
  AND (
    token = 'y+J70lzMpKhuxV3OVSyjPIoyyX+uSj3sfkWqdZ1jrZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028