UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9InWTOAKUzf5yeiizQi9JBJdcC1DE1oyebE93SIhbcw=' 
WHERE 
  key_id = '6e2da2f1026a786644e3d685109ba4749922b5cec03e134b8185913310c81161' 
  AND (
    token = '9InWTOAKUzf5yeiizQi9JBJdcC1DE1oyebE93SIhbcw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046