UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mh18T1embQWjv3rfyxezue9S956hkM+J4jzoUqSOPI8=' 
WHERE 
  key_id = '250939734c34a280862d58db99f4d13e81a3ec16a4124cea869b6d15a6fe4038' 
  AND (
    token = 'Mh18T1embQWjv3rfyxezue9S956hkM+J4jzoUqSOPI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032