UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i/h8LNZyCMVYXwtYY2sQWZuE5ghCoatxo3J7V3Bwkjc=' 
WHERE 
  key_id = '52ba1799190b9d850e793371915fb7a565f6fe2ba08743564910f0103a519d07' 
  AND (
    token = 'i/h8LNZyCMVYXwtYY2sQWZuE5ghCoatxo3J7V3Bwkjc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025