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

Query time 0.00023