UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CVdecOWepGQIiciMtGvd3xuVTh89LulbhOF4zZtc+yM=' 
WHERE 
  key_id = '7759b4c65f0c7b966810a35220156261fe744d8112b32e39309e49c17d24ff64' 
  AND (
    token = 'CVdecOWepGQIiciMtGvd3xuVTh89LulbhOF4zZtc+yM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032