UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dgOdfjU+FNj7ZKE5L11jeJkIYm2ihqsDEnEozKXMONM=' 
WHERE 
  key_id = '77880c95664cf52c42d1e7b9f170e2c00e9f138f153cc4e2dfce239fedad168b' 
  AND (
    token = 'dgOdfjU+FNj7ZKE5L11jeJkIYm2ihqsDEnEozKXMONM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022