UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O+Olqhh1AAKx5mRcEnPZROrGaOukWnmaELgOVVNFrvo=' 
WHERE 
  key_id = '499c2d3d6d6770c4a95d1f7dab9a8d7013a0a87cb65bcf159e6c9c8a9bdc1636' 
  AND (
    token = 'O+Olqhh1AAKx5mRcEnPZROrGaOukWnmaELgOVVNFrvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026