UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WrCxx9rcojGLotX44UPvJskn4NsSnLxJ2rDQ9nlyyyw=' 
WHERE 
  key_id = 'd67310c68cff6899476ad67542132ee72a4ce3acca186c88c188c3bf8277bc40' 
  AND (
    token = 'WrCxx9rcojGLotX44UPvJskn4NsSnLxJ2rDQ9nlyyyw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032