UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9c1iNZHX/NlANx2Pb+3Zch9I2V7IyJwAxdazpQtx7Po=' 
WHERE 
  key_id = '6023acb16182329b464fbca2b8d995e6073c77cc79c063f292f0234076d0498f' 
  AND (
    token = '9c1iNZHX/NlANx2Pb+3Zch9I2V7IyJwAxdazpQtx7Po=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037