UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I2KHa4R36Vaegs4XVpl1Ga52nONaf+CodNM56C5/rX0=' 
WHERE 
  key_id = '06c3f3af043b4d273f57c5890b01d5bdb684192c77d01dc3f8f58d94acbd1ca8' 
  AND (
    token = 'I2KHa4R36Vaegs4XVpl1Ga52nONaf+CodNM56C5/rX0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017