UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M/R1qEPBDT0vHmWMYzNE+EbVl10KHsIEB4s3Hklyiwg=' 
WHERE 
  key_id = '637c17c8949ae6c463158be4ca555d731268a2c9647e21cd13a6497289ad1b76' 
  AND (
    token = 'M/R1qEPBDT0vHmWMYzNE+EbVl10KHsIEB4s3Hklyiwg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026