UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd+COHQ3UzQzuC5s3UNRQ+bXVR2lD1udPaC5sEV1Cv+U=' 
WHERE 
  key_id = 'be3f909a296b98c7bbc03377452ba97fa98009b856efb6eae06264e3479de9e2' 
  AND (
    token = 'd+COHQ3UzQzuC5s3UNRQ+bXVR2lD1udPaC5sEV1Cv+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030